<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="Cache-Control" content="public" />
    <meta name="msapplication-tap-highlight" content="no" />
    <meta name="viewport"
        content="width=device-width, height=device-height, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>汽车在线</title>
    <link type="text/css" rel="stylesheet" href="css/global.css" />
    <style>
        .info-container {
            width: 100%;
            padding-top: 3.5em;
        }

        .info-container li {
            border-bottom: 1px solid #ccc;
            padding: 10px;
        }
    </style>
    <script src="js/lang_cn.js"></script>
    <script src="js/brand/zepto.min.js"></script>
    <script src="js/global.js"></script>
</head>

<body>
    <div class="container">
        <div class="header">
            <h3 class="title">
                <a class="back" href="javascript:history.back();"></a><a class="toolbox hidden" href=""></a>设备信息
            </h3>
        </div>
        <div>
            <ul class="info-container">
                <li>设备名：<span id="name"></span></li>
                <li>车牌号：<span id="number"></span></li>
                <li>设备电话(SIM卡号)：<span id="phone"></span></li>
                <li>产品类型：<span id="dev_type"></span></li>
                <li>开通日期：<span id="in_time"></span></li>
                <li>到期日期：<span id="out_time"></span></li>
                <li>设备号(IMEI)：<span id="imei"></span></li>
                <li>地址：<span id="address"></span></li>
            </ul>
        </div>
    </div>
    <script type="text/javascript">
        (function () {
            var params = goome.wx.utils.params();
            function loadBaseInfo() {
                $.ajax({
                    url: goome.wx.config.apiUrl + 'account/devinfo',
                    dataType: 'jsonp',
                    data: params,
                    success: function (result) {
                        if (result && result.errcode === 0) {
                            renderBaseInfo(result.data);
                        } else {
                            goome.wx.utils.showTip(result);
                        }
                    },
                    error: function (err) {
                        goome.wx.utils.showTip(err);
                    }
                })
            }
            function renderBaseInfo(list) {
                $.each(list, function (i, data) {
                    if (data.imei == params.imei) {
                        $('#name').text(data.name);
                        $('#number').text(data.number);
                        $('#phone').text(data.phone);
                        $('#dev_type').text(data.dev_type);
                        $('#in_time').text(goome.wx.utils.dateFormat(data.in_time));
                        $('#out_time').text(goome.wx.utils.dateFormat(data.out_time));
                        $('#imei').text(data.imei);
                        return false;
                    }
                });
            }
            function init() {
                loadBaseInfo();
                goome.wx.utils.getAddress(params.lng, params.lat, function (address) {
                    $('#address').text(address);
                });
            }
            init();
        })();
    </script>
</body>

</html>